# -*- coding: utf-8 -*-
"""
 @Time    : 2021/1/28 下午4:43
 @Author  : tgy
 
"""
class MyType(type):
    ...
    name = 9999


# class在全局命名空间定义属性为Person，创建类对象，使用 Person指向这个类对象，类对象是独立的命名空间，要访问里面的属性，必须加上Person.test
class Person(metaclass=MyType):
    ...
    # name = '132'
    def test(self):
        ...

class Stu(Person):

    __slots__ = ['score']
    # score = 12
    def __init__(self):
        self.score = 100
        # self.name = 12
        # self.name = 21

if __name__ == '__main__':
    ...
    print(Person.__dict__)
    Person.test('123')
    print(Stu.__dict__)
    stu = Stu()
    print(stu.__dict__)
    print(stu.__class__)
    print(Stu.__bases__)
    print(Stu.name)